package com.starhub.application.collection.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.starhub.application.collection.entity.KnowledgeCollection;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 知识库表Mapper接口
 * @version: V1.0
 * @author: liuhf
 * @time 2025-06-05
 */
@Mapper
public interface KnowledgeCollectionMapper extends BaseMapper<KnowledgeCollection> {

    /**
     * 根据标识查询知识库表
     * @param collectionIdentifier
     * @return
     */
    KnowledgeCollection selectByIdentifier(@Param("collectionIdentifier") String collectionIdentifier);

    /**
     * 根据标识查询知识库表数量
     * @param collectionIdentifier
     * @return
     */
    long countByIdentifier(@Param("collectionIdentifier") String collectionIdentifier);

    /**
     * 根据ID批量查询知识库表
     * @param ids
     * @return
     */
    List<KnowledgeCollection> selectBatchIds(@Param("ids") List<Long> ids);

    /**
     * 根据文本内容和集合ID查询数据ID
     * @param content 文本内容
     * @param collectionId 集合ID
     * @param tableName 表名
     * @return 数据ID，如果不存在返回null
     */
    String queryDataIdByContent(@Param("content") String content, 
                               @Param("collectionId") Long collectionId, 
                               @Param("tableName") String tableName);
} 